#include <iostream>
#include <sstream>
#include <string>
#include <memory>
#include <jsoncpp/json/json.h>

int main()
{
    
    const char *name = "小明";
    int age = 18;
    float score[] = {83, 75.5, 23.4};

    Json::Value root;
    root["姓名"] = name;
    root["年纪"] = age;
    for (int i = 0; i < 3; i++)
    {
        root["分数"].append(score[i]);
    }
    Json::StreamWriterBuilder swb;
    swb["emitUTF8"] = true;
    std::unique_ptr<Json::StreamWriter> sw(swb.newStreamWriter());
    std::stringstream ss;
    sw->write(root, &ss);
    std::cout << ss.str() << std::endl;
    return 0;
}
